home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Applications / Demos_Demo folder / Demos_Info folder / Demos™ Demonstration / Examples / Swapping y and x-index < prev   
Text File  |  1993-08-10  |  2KB  |  67 lines

  1. { From user A Lumens, Project Swapping at Tue, Aug 10, 1993 2:52 PM}
  2.  
  3.  
  4. { System Variables with non-default values: }
  5. Typechecking := 1
  6. Checking := 1
  7. Saveoptions := 2
  8. Savevalues := 0
  9.  
  10.  
  11. { Non-default Time SysVar value: }
  12. Time := [0,1,2]
  13.  
  14. Project Swapping
  15. Title: Swapping y and x-index
  16. Description: This model demonstrates how to swap a computed or one-dimensional table value with its Index (thus making the computed value an index).
  17. Author: A Lumens
  18. Date: Mon, Aug 9, 1993 12:05 PM
  19. Saveauthor: A Lumens
  20. Savedate: Tue, Aug 10, 1993 2:52 PM
  21. Defaultsize: 48,20
  22. Diagstate: 1,40,50,443,196,3
  23. Fileinfo: 0,-5,6752,Project Swapping,Swapping y and x-index
  24. Getresource 
  25.  
  26. Index X
  27. Title: x
  28. Description: A set of alternative values representing an Index.
  29. Definition: [1,2,5]
  30. Location: 72,56
  31. Nodesize: 48,20
  32. Windstate: 1,157,150
  33. Valuestate: 1,168,178,268,137,0,MIDM
  34.  
  35. Chance Y_of_x
  36. Title: y = f(x)
  37. Description: Some function of x, or a table indexed by x (in this example, a table indexed by x).
  38. Definition: Table(X)(
  39. 5,20,30)
  40. Location: 72,120
  41. Nodesize: 48,20
  42. Windstate: 1,129,162
  43. Defnstate: 1,110,367,416,303,0,MIDM
  44. Valuestate: 1,113,209,289,137,0,MIDM
  45.  
  46. Index Y
  47. Title: y
  48. Description: Extracts the values of z_of_x to generate an Index.~
  49. ~
  50. It iterates across the length of index x, using the sequence function (which will generate an un-indexed array), and slicing out each value of z_of_x.  Because Sequence generates an array, Demos treats the result for z as an Index.
  51. Definition: Using i := Sequence(1,Size(X)) Do Slice(Y_of_x,X,i)
  52. Location: 200,120
  53. Nodesize: 48,20
  54. Windstate: 1,185,182
  55. Valuestate: 1,205,210,242,137,0,MIDM
  56.  
  57. Chance X_of_y
  58. Title: x = f(y)
  59. Description: This creates an Array using x as the values, and assigning y as the Index.  As long as these are the same length, Demos will make the assignment.
  60. Definition: Array( y, x )
  61. Location: 320,88
  62. Nodesize: 48,20
  63. Windstate: 1,217,127
  64. Valuestate: 1,385,383,278,137,0,MIDM
  65.  
  66. Close Swapping
  67.